package cn.duli.xianer.service.impl;

import cn.duli.xianer.dao.TypesMapper;
import cn.duli.xianer.pojo.Types;
import cn.duli.xianer.service.TypesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TypesServiceImpl implements TypesService {

    @Resource
    private TypesMapper typesMapper;

    @Override
    public void save(Types types) {
        typesMapper.save(types);
    }

    @Override
    public void update(Types types) {
        typesMapper.update(types);
    }

    @Override
    public void deleteById(Integer tId) {
        typesMapper.deleteById(tId);
    }

    @Override
    public Types findById(Integer tId) {
        return typesMapper.findById(tId);
    }

    @Override
    public List<Types> findOneLevels() {
        return typesMapper.findOneLevels();
    }

    @Override
    public List<Types> findTwoLevels(Integer tParentId) {
        return typesMapper.findTwoLevels(tParentId);
    }

    @Override
    public void cancelDeleteById(Integer tId) {
        typesMapper.cancelDeleteById(tId);
    }

    @Override
    public boolean checkByTname(String tName) {
        Types type = typesMapper.findByTname(tName);
        return type==null?true:false;
    }
}
